<script lang="ts">
	import { webviewWindow } from "@tauri-apps/api";
	import { appState } from "../../../stores/state.svelte";

	let src = $derived(appState.playItem?.play_infos[appState.playIndex].url ?? "")
	async function ondblclick(e:Event) {
		await webviewWindow.getCurrentWebviewWindow().setFullscreen(!await webviewWindow.getCurrentWebviewWindow().isFullscreen());
		console.log("[video]: 全屏状态更改");
	}
</script>

<main>
	<!-- <video controls controlsList="nofullscreen nodownload" autoplay {ondblclick}>
		<track kind="captions">
		<source {src}/>
	</video> -->
	
	<iframe {src} frameborder="0"></iframe>
</main>

<style lang="scss">
	main {
		width: 100%; height: 100%;
		overflow: hidden;
		display: flex;

		video {
			width: 100%; height: 100%;
		}

		iframe {
			width: 100%; height: 100%;
		}
	}	
</style>